package cn.iocoder.yudao.module.famous.doctor.dal.mysql.diseaseLabel;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.famous.doctor.dal.dataobject.diseaseLabel.DiseaseLabelDO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.famous.doctor.controller.admin.diseaseLabel.vo.*;

/**
 * 疾病标签 Mapper
 *
 * @author 档案
 */
@Mapper
public interface DiseaseLabelMapper extends BaseMapperX<DiseaseLabelDO> {

    default PageResult<DiseaseLabelDO> selectPage(DiseaseLabelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DiseaseLabelDO>()
                .likeIfPresent(DiseaseLabelDO::getName, reqVO.getName())
                .betweenIfPresent(DiseaseLabelDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DiseaseLabelDO::getLabelType, reqVO.getLabelType())
                .orderByDesc(DiseaseLabelDO::getId));
    }

    default List<DiseaseLabelDO> selectList(DiseaseLabelExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DiseaseLabelDO>()
                .likeIfPresent(DiseaseLabelDO::getName, reqVO.getName())
                .betweenIfPresent(DiseaseLabelDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DiseaseLabelDO::getLabelType, reqVO.getLabelType())
                .orderByDesc(DiseaseLabelDO::getId));
    }

    List<DiseaseLabelRespVO> selectInids(String diseaseLabelIds);

    default DiseaseLabelDO selectByParentIdAndName(Long parentId, String name){
        return selectOne(DiseaseLabelDO::getParentId, parentId, DiseaseLabelDO::getName, name);
    }

    default Long selectCountByParentId(Long parentId) {
        return selectCount(DiseaseLabelDO::getParentId, parentId);
    }
}
